<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>C++ Tutorial: Multi-Threaded Programming - C++ Thread for Win32</title>
  <meta
 content="C++ Tutorial: Multi-Threaded Programming II"
 name="description" />
  <meta
 content="C++ Tutorial, Multi-Threaded Programming II, MultiThreading Programming, _beginthreadex(), Runnable, join(), start(), C++ Thread for Win32"
 name="keywords" />
  <meta http-equiv="Content-Type"
 content="text/html; charset=ISO-8859-1" />
  <link type="text/css" rel="stylesheet" href="../images/bogostyleWidePre.css" />
</head>
<body>
<div id="page" align="center">
<div id="content" style="width: 800px;">
<div id="logo">
<div class="whitetitle" style="margin-top: 70px;">bogotobogo </div>
</div>
<div id="topheader">
<div class="headerbodytext" align="left"><br />
<strong>Bogotobogo</strong><br />
contact@bogotobogo.com </div>
<div class="smallgraytext" id="toplinks"><a href="../index.html">Home</a>
| <a href="../sitemap.html">Sitemap</a>
| <a href="../blog" target="_blank">Contact Us</a>
</div>
</div>
<div id="menu">
<div class="smallwhitetext" style="padding: 9px;" align="right"><a
 href="../index.html">Home</a>
| <a href="../about_us.html">About Us</a>
| <a href="../products.html">Products</a>
| <a href="../our_services.html">Our Services</a>
| <a href="../blog" target="_blank">Contact Us</a>
</div>
</div>
<div id="submenu">
<div class="smallgraytext" style="padding: 9px;" align="right">
<a href="../gif.html">Gif</a> 
|<a href="../java_applet.html">JavaApplet/Web Start</a>
| <a href="../flash.html">Flash</a>
| <a href="../shockwave.html">ShockWave</a>
| <a href="../svg.html">SVG</a>
| <a href="../iPhone.html">iPhone/iPad</a>
| <a href="../android.html">Android</a>
| <a href="../OnHTML5.html">HTML5</a>
| <a href="../Algorithms/algorithms.html">Algorithms</a>
| <a href="../News/NewsMain.html">News</a>
| <a href="../cplusplus/cpptut.html">C++</a>
| <a href="../Java/tutorial/on_java.html">Java</a>
| <a href="../php/phptut.html">PHP</a>
| <a href="../DesignPatterns/introduction.html">Design Patterns</a>
| <a href="../python/pytut.html">Python</a> 
| <a href="../CSharp/.netframework.html">C#</a>
| <a href="../forums.html">Forums</a> 
| <a href="../VisualBasicSQL/introduction.html">Visual Basic</a>
</div>
</div>

<div id="contenttext">

<!-- Use of this code assumes agreement with the Google Custom Search Terms of Service. -->
<!-- The terms of service are available at http://www.google.com/cse/docs/tos.html -->
<form name="cse" id="searchbox_demo" action="http://www.google.com/cse">
  <input type="hidden" name="cref" value="" />
  <input type="hidden" name="ie" value="utf-8" />
  <input type="hidden" name="hl" value="" />
  <input name="q" type="text" size="40" />
  <input type="submit" name="sa" value="Search" />
</form>
<script type="text/javascript" src="http://www.google.com/cse/tools/onthefly?form=searchbox_demo&lang="></script>

<div id="bookmarkshare">
<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&amp;username=khhong7"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=khhong7"></script>
</div>
<br />
<br />
<br />
<br />
<div style="padding: 10px;"><span class="titletext">C++ Tutorial<br />
Multi-Threaded Programming II <br />
C++ Thread for Win32</span></div>
<img src="../images/cplusplus/cpp_logo.jpg" alt="cplusplus logo"/>

<div class="bodytext" style="padding: 12px;" align="justify"> 
<div class="subtitle_2nd" id="FullList">Full List of C++ Tutorials</div>
<ul>
   <li><a href="cpptut.html">C++ Home</a> </li>
   <li><a href="string.html">String</a> </li>
   <li><a href="constructor.html">Constructor</a> </li>
   <li><a href="operatoroverloading.html">Operator Overloading</a> </li>
   <li><a href="virtualfunctions.html">Virtual Functions</a></li>
   <li><a href="dynamic_cast.html">Dynamic Cast Operator</a></li>
   <li><a href="typecast.html">Type Cast Operators</a></li>
   <li><a href="autoptr.html">Class auto_ptr</a></li>   
   <li><a href="templates.html">Templates</a></li>
   <li><a href="references.html">References for Built-in Types</a></li>
   <li><a href="valuevsreference.html">Pass by Value vs. Pass by Reference</a></li>
   <li><a href="memoryallocation.html">Memory Allocation</a></li>
   <li><a href="friendclass.html">Friend Functions and Friend Classes</a></li>
   <li><a href="functors.html">Functors (Function Objects)</a></li>
   <li><a href="statics.html">Static Variables and Static Class Members</a></li>
   <li><a href="exceptions.html">Exceptions</a></li>
   <li><a href="stackunwinding.html">Stack Unwinding</a></li>
   <li><a href="pointers.html">Pointers</a></li>
   <li><a href="pointers2.html">Pointers II</a></li>
   <li><a href="pointers3.html">Pointers III</a></li>
   <li><a href="assembly.html">Taste of Assembly</a></li>
   <li><a href="smallprograms.html">Small Programs</a></li>
   <li><a href="linkedlist.html">Linked List Examples</a></li>
   <li><a href="binarytree.html">Binary Tree Example Code</a></li>
   <li><a href="stl.html">Standard Template Library (STL) I</a></li>
   <li><a href="stl2.html">Standard Template Library (STL) II - Maps</a></li>
   <li><a href="stl3_iterators.html">Standard Template Library (STL) III - Iterators</a></li>
   <li><a href="slicing.html">Object Slicing and Virtual Table</a></li>
   <li><a href="this_pointer.html">The this Pointer</a></li>
   <li><a href="stackunwinding.html">Stack Unwinding</a></li>
   <li><a href="upcasting_downcasting.html">Upcasting and Downcasting</a></li>
   <li><a href="object_returning.html">Object Returning</a></li>
   <li><a href="private_inheritance.html">Private Inheritance</a></li>
   <li><a href="cplusplus_keywords.html">C++_Keywords</a></li>
   <li><a href="multithreaded.html">Multi-Threaded Programming - Terminology</a></li>
   <li><a href="multithreaded2A.html">Multi-Threaded Programming II - Native Thread for Win32 (A) </a></li>
   <li><a href="multithreaded2B.html">Multi-Threaded Programming II -  Native Thread for Win32 (B) </a></li>
   <li><a href="multithreaded2C.html">Multi-Threaded Programming II -  Native Thread for Win32 (C) </a></li>
   <li><a href="multithreaded2.html">Multi-Threaded Programming II - C++ Thread for Win32</a></li>
   <li><a href="multithreaded3.html">Multi-Threaded Programming III - C++ Class Thread for Pthreads</a></li>
   <li><a href="multithreadedDebugging.html">Multithread Debugging</a></li>
   <li><a href="embeddedSystemsProgramming.html">Embedded Systems Programming</a></li>
   <li><a href="boost.html">Boost</a></li>
   <li>Programming Questions and Solutions
    <ul>
       <li><a href="quiz_strings_arrays.html">Strings and Arrays</a></li>
       <li><a href="quiz_linkedlist.html">Linked List</a></li>
       <li><a href="quiz_recursion.html">Recursion</a></li>
       <li><a href="quiz_bit_manipulation.html">Bit Manipulation</a> </li>
       <li><a href="google_interview_questions.html">140 Google Interview Questions</a> </li>
    </ul>
   </li>
</ul>
</div>
<br />


<div class="bodytext" style="padding: 12px;" align="justify">
<div class="subtitle" id="mth2">Multi-Threaded Programming II</div>
<p>Multithreaded programs are most of the cases using <a href="../Java/tutorial/threads.html" target="_blank">Java Threading</a>, the POSIX PThreads library, and the Windows API. In this tutorial on multithreaded, we'll make <strong>C++ Thread</strong> class hiding the details of thread creation in <strong>Pthreads/Win32</strong>.</p>
<br /><br />
<br />
	<br />
	<img src="images/multithread2/MyungSungSan4.png" alt="MyungSungSan4"/>
	<br /><br />
<div class="subtitle_2nd" id="concurrent">Concurrent Programming</div>
<p>When two or more threads are programmed to be executed concurrently and to work together to perform some task, we call it concurrent program. The OS manages the usage of resources by the program.</p>
<p>Java provides a <strong>Thread</strong> class and Win32 and Pthreads provide a set of function calls for creating and manipulating threads. </p>
<p>All concurrent programs exhibit behavior that is unpredictable. This creates plethora of challenges for programmers when they write concurrent programs.</p> 
<br />
<br />


<div class="subtitle_2nd" id="win32">C++ Class Thread for Win32</div>
<pre>
#include &lt;iostream&gt;
#include &lt;memory&gt;
#include &lt;cassert&gt;
#include &lt;windows.h&gt;
#include &lt;process.h&gt;

class <font color="blue">Runnable</font> {
public:
	virtual void* run() = 0;
	virtual ~Runnable() = 0;
};

// Pure virtual destructor: function body required
Runnable::~Runnable(){};

class <font color="blue">Thread</font> {
public:
	Thread(std::auto_ptr&lt;Runnable&gt; run);
	Thread();
	virtual ~Thread();
	void start();
	void* join();
private:
	HANDLE hThread;
	unsigned wThreadID;
	// runnable object will be deleted automatically
	std::auto_ptr&lt;Runnable&gt; runnable;
	Thread(const Thread&);
	const Thread& operator=(const Thread&);
	// called when run() completes
	void setCompleted();
	// stores return value from run()
	void* result;
	virtual void* run() {return 0;}
	static unsigned WINAPI startThreadRunnable(LPVOID pVoid);
	static unsigned WINAPI startThread(LPVOID pVoid);
	void printError(LPTSTR lpszFunction, LPSTR fileName, int lineNumber);
};

Thread::Thread(std::auto_ptr&lt;Runnable&gt; r) : runnable(r) {
	if(!runnable.get())
		printError("Thread(std::auto_ptr&lt;Runnable&gt; r) failed at ",
				__FILE__, __LINE__);
	hThread = 
		(HANDLE)_beginthreadex(NULL,0,Thread::startThreadRunnable,
				(LPVOID)this, CREATE_SUSPENDED, &wThreadID);
	if(!hThread)
		printError("_beginthreadex failed at ",__FILE__, __LINE__);
}

Thread::Thread() : runnable(NULL) {
	hThread = 
		(HANDLE)_beginthreadex(NULL,0,Thread::startThread,
				(LPVOID)this, CREATE_SUSPENDED, &wThreadID);
	if(!hThread)
		printError("_beginthreadex failed at ",__FILE__, __LINE__);
}

unsigned WINAPI Thread::startThreadRunnable(LPVOID pVoid) {
	Thread* runnableThread = static_cast&lt;Thread*&gt;(pVoid);
	runnableThread-&gt;result = runnableThread-&gt;runnable-&gt;run();
	runnableThread-&gt;setCompleted();
	return reinterpret_cast&lt;unsigned&gt;(runnableThread-&gt;result);
}

unsigned WINAPI Thread::startThread(LPVOID pVoid) {
	Thread* aThread = static_cast&lt;Thread*&gt;(pVoid);
	aThread-&gt;result = aThread-&gt;run();
	aThread-&gt;setCompleted();
	return reinterpret_cast&lt;unsigned&gt;(aThread-&gt;result);
}

Thread::~Thread() {
	if(wThreadID != GetCurrentThreadId()) {
		DWORD rc = CloseHandle(hThread);
		if(!rc) printError
			("CloseHandle failed at ",__FILE__, __LINE__);
	}
}

void Thread::start() {
	assert(hThread);
	DWORD rc = ResumeThread(hThread);
	// thread created is in suspended state, 
	// so this starts it running
	if(!rc) printError
			("ResumeThread failed at ",__FILE__, __LINE__);
}

void* Thread::join() {
	// A thread calling T.join() waits until thread T completes.
	return result;
}

void Thread::setCompleted() {
	// Notify any threads that are waiting in join()
}

void Thread::printError(LPSTR lpszFunction, LPSTR fileName, int lineNumber)
{
	TCHAR szBuf[256];
	LPSTR lpErrorBuf;
	DWORD errorCode=GetLastError();
	FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER||
		FORMAT_MESSAGE_FROM_SYSTEM,
		NULL,
		errorCode,
		MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
		(LPTSTR)&lpErrorBuf,
		0,
		NULL);
	wsprintf(szBuf,"%s failed at line %d in %s with error %d: %s", 
		     lpszFunction, lineNumber, fileName, errorCode, lpErrorBuf);
	DWORD numWritten; 
	WriteFile(GetStdHandle(STD_ERROR_HANDLE),
		szBuf,
		strlen(reinterpret_cast &lt;const char *&gt; (szBuf)),
		&numWritten,
		FALSE);
	LocalFree(lpErrorBuf);
	exit(errorCode);
}

class <font color="blue">simpleRunnable</font>: public Runnable {
public:
	simpleRunnable(int ID) : myID(ID) {}
	virtual void* run() {
		std::cout << "Thread " << myID << " is running" << std::endl;
		return reinterpret_cast&lt;void*&gt;(myID);
	}
private:
	int myID;
};

class <font color="blue">simpleThread</font>: public Thread {
public:
	simpleThread(int ID) : myID(ID) {}
	virtual void* run() {
		std::cout << "Thread " << myID << " is running" << std::endl;
		return reinterpret_cast&lt;void*&gt;(myID);
	}
private:
	int myID;
};

int main() {
	// thread1 and thread2 are created on the heap
	// thread3 is created on the stack
	// The destructor for thread1 and thread2 will automatically 
	// delete the thread objects.
	std::auto_ptr&lt;Runnable&gt; r(new simpleRunnable(1));
	std::auto_ptr&lt;Thread&gt; thread1(new Thread(r));
	thread1-&gt;start();
	std::auto_ptr&lt;simpleThread&gt; thread2(new simpleThread(2));
	thread2-&gt;start();
	simpleThread thread3(3);
	thread3.start();
	// wait for the threads to finish
	int result1 = reinterpret_cast&lt;int&gt;(thread1-&gt;join());
	int result2 = reinterpret_cast&lt;int&gt;(thread2-&gt;join());
	int result3 = reinterpret_cast&lt;int&gt;(thread3.join());
	std::cout << result1 << ' ' << result2 << ' ' << result3 
		<< std::endl;
	return 0;
}
</pre>
<br />
	<br />
	<img src="images/multithread2/MyungSungSan3.png" alt="MyungSungSan3"/>
	<br /><br />


<p>Let's look at the code in detail.</p>
<ol>
	<li>We have two major C++ classes: <strong>Runnable</strong> and <strong>Thread</strong>.</li>
	<li>The <strong>run()</strong> method is returning a value utilizing the fact that Win32 thread functions can return a value.</li>
	<li>The return value can be retrieved by using a Pthread-style call to method <strong>join()</strong>.</li>
	<li>Class <strong>Runnable</strong> mimics Java's <strong>Runnable</strong> interface.</li>
	<li>We created threads in the same way as Java did: we write a C++ class that provides a <strong>run()</strong> method and inherits from <strong>Runnable</strong>.
<pre>
class simpleRunnable: public Runnable {
public:
	...
	virtual void* run() {
	...
};
</pre></li>
	<li>We created an instance of this class.
<pre>
std::auto_ptr&lt;Runnable&gt; r(new simpleRunnable(1));
</pre>
	</li>
	<li>Then, pass a pointer to that instance as an argument to the <strong>Thread</strong> class constructor.
<pre>
std::auto_ptr&lt;Thread&gt; thread1(new Thread(r));
</pre>
	</li>

</pre>
	<li>We call <strong>start()</strong> on that <strong>Thread</strong> object.
<pre>
thread1-&gt;start();
</pre>
	<li>Class <strong>Thread</strong> also provides a <strong>join()</strong> method that simulates the <strong>pthread_join()</strong> operation.</li>
	<li>A call to <strong>T.join()</strong> blocks the caller until thread <strong>T's run()</strong> method completes.</li>
	<li>We use <strong>T.join()</strong> to ensure that <strong>T's run()</strong> method is completed before <strong>Thread T</strong> is destructed and the <strong>main</strong> thread completes.</li>
	<li>Method <strong>join()</strong> returns the value that we returned by <strong>run()</strong>.</li>
	<li>Method <strong>join()</strong> is useful in Java when one threads needs to make sure that other threads have completed before accessing their results.</li>
	<li>But Java's <strong>run()</strong> method cannot return a value, so results must be obtained some other way.</li>
	<li>The implementation is not simple. When a C++ <strong>Thread</strong> is created, the corresponding <strong>Thread</strong> constructor calls function <strong>_beginthreadex()</strong></li>
	<li>The <strong>_beginthreadex()</strong> with the following arguments:<br />
	<ul>
		<li><strong>NULL</strong> <br />
		This is the default value for security attributes. </li>
		<li><strong>0</strong> <br />
		This is the default value for stack size.</li>
		<li><strong>Thread::startThread()</strong> or <strong>Thread::startThreadRunnable()</strong> <br />
		Method <strong>startThread()</strong> is the startup method for threads created by inheriting from class <strong>Thread</strong>. Method <strong>startThreadRunnable()</strong> is the startup method for threads created from <strong>Runnable</strong> object.</li>
		<li><strong>(LPVOID)this</strong> <br />
		The fourth argument is a pointer to this <strong>Thread</strong> object, which is passed through to method <strong>startThread()</strong> or <strong>startThreadRunnable()</strong>. Thus, all threads execute one of the startup methods, but the startup methods receive a different <strong>Thread</strong> pointer each time they are executed.</li>
		<li><strong>CREATED_SUSPENDED</strong> <br />
		A Win32 thread is created to execute the startup method, but this thread is created in suspended mode, so the startup method does not begin executing until <strong>start()</strong> is called on the thread.
<pre>
thread1-&gt;start();
</pre>
</li>
	</ul>
	</li>
	<li>The thread is not actually started until method <strong>Thread::start()</strong> calls Win32 function <strong>ResumeThread()</strong>, which allows the thread to be scheduled and the startup method to begin execution.
<pre>
void Thread::start() {
	assert(hThread);
	DWORD rc = ResumeThread(hThread);
	// thread created is in suspended state, 
	// so this starts it running
}
</pre>
</li>
	<li>The startup method is either <strong>startThread()</strong> or <strong>startThreadRunnable()</strong> depending on which <strong>Thread</strong> constructor was used to create the <strong>Thread</strong> object.</li>
	<li>Method <strong>startThread()</strong> casts its <strong>void*</strong> pointer to <strong>Thread*</strong>.
<pre>
Thread* aThread = static_cast&lt;Thread*&gt;(pVoid);
</pre>
	</li>
	<li>Then, it calls the <strong>run()</strong> method of its <strong>Thread*</strong> parameter.
<pre>
aThread-&gt;result = aThread-&gt;run();
</pre>
	</li>
	<li>When the <strong>run()</strong> method returns, <strong>startThread()</strong> calls <strong>setCompleted()</strong> to set the thread's status to completed and to notify any threads waiting in <strong>join()</strong> that the thread has completed.
<pre>
aThread->setCompleted();
</pre>
	</li>
	<li>The return value of the <strong>run()</strong> method is saved so that it can be retrieved in method <strong>join()</strong>.	</li>
	<li>Static method <strong>startThreadRunnable()</strong> performs similar steps when thread are created from <strong>Runnable</strong> objects.</li>
	<li>We use <strong>auto_ptr&lt;&gt;</strong> objects to manage the destruction of two of the threads and the <strong>Runnable</strong> object <strontg>r</strong>.
<pre>
std::auto_ptr&lt;Runnable&gt; r(new simpleRunnable(1));
std::auto_ptr&lt;Thread&gt; thread1(new Thread(r));
...
std::auto_ptr&lt;simpleThread&gt; thread2(new simpleThread(2));
</pre>
	</li>
	<li>When <strong>auto_ptr&lt;&gt;</strong> objects <strong>thread1</strong> and <strong>thread2</strong> are destroyed automatically at the end of the program, their destructors will invoke <strontg>delete</strong> automatically on the pointers with which they were initialized.</li>
	<li>Passing <strong>auto_ptr&lt;Runnable&gt;</strong> object to the <strong>Thread</strong> class constructor passes ownership of the <strong>Runnable</strong> object from the <strong>main</strong> thread to the child thread.</li>
	<li>The <strong>auto_ptr&lt;Runnable&gt;</strong> object in the child thread that receives the <strong>auto_ptr&lt;Runnable&gt;</strong> object owns the <strong>Runnable</strong> object that it has a pointer to, and will automatically delete the pointed-to object when the child thread is destroyed.</li>
	<li>When ownership is passed to the thread, the <strong>auto_ptr&lt;Runnable&gt;</strong> object in <strong>main</strong> is set automatically to a null state and can no longer be used to refer to the <strong>Runnable</strong> object. This protects against double deletion by the child thread and the <strong>main</strong> thread. It also prevents <strong>main</strong> from deleting the <strong>Runnable</strong> object before the thread has completed method <strong>run()</strong> and from accessing the <strong>Runnable</strong> object while the thread is accessing it.</li>
	<li>The startup functions, <strong>startThreadRunnable()</strong> and <strong>startThread()</strong> are static member functions. This is because the <strong>_beginthreadex()</strong> expects to receive the address of a startup function that has a single <strong>(void*)</strong> parameter.
<pre>
unsigned WINAPI Thread::startThread(LPVOID pVoid) {
	Thread* aThread = static_cast&lt;Thread*&gt;(pVoid);
	....
}
</pre>
A nonstatic member function that declares a single parameter actually has <strong>two</strong> parameters because of <strong>this</strong> pointer. So, if the startup function is a nonstatic member function, the hidden parameter, <strong>this</strong>, gets in the way and the call to the startup function fails. But the static member functions do not have this hidden parameter.
</li>
	<li>The results of the run are quite unpredictable as we predicted.<br />
	<br />
	<img src="images/multithread2/run1.png" alt="run1"/>
	<br /><br />
	<img src="images/multithread2/run2.png" alt="run2"/>
	<br /><br />
	<img src="images/multithread2/run3.png" alt="run3"/>
	<br /><br />
	<img src="images/multithread2/run4.png" alt="run4"/>
	<br /><br />
	<img src="images/multithread2/run5.png" alt="run5"/>
	<br /><br />

</li>
</ol>

<p>note: This tutorial on Multithreads for Win32 is largely based on the book "Modern Multithreading" by Carver and Tai. Here, I converted it more reader friendly.</p>

<div id="rightpanel">
<div align="center">
</div></div>

<br /><br />
<div class="subtitle_2nd" id="FullList">Full List of C++ Tutorials</div>
<ul>
   <li><a href="cpptut.html">C++ Home</a> </li>
   <li><a href="string.html">String</a> </li>
   <li><a href="constructor.html">Constructor</a> </li>
   <li><a href="operatoroverloading.html">Operator Overloading</a> </li>
   <li><a href="virtualfunctions.html">Virtual Functions</a></li>
   <li><a href="dynamic_cast.html">Dynamic Cast Operator</a></li>
   <li><a href="typecast.html">Type Cast Operators</a></li>
   <li><a href="autoptr.html">Class auto_ptr</a></li>
   <li><a href="templates.html">Templates</a></li>
   <li><a href="references.html">References for Built-in Types</a></li>
   <li><a href="valuevsreference.html">Pass by Value vs. Pass by Reference</a></li>
   <li><a href="memoryallocation.html">Memory Allocation</a></li>
   <li><a href="friendclass.html">Friend Functions and Friend Classes</a></li>
   <li><a href="functors.html">Functors</a></li>
   <li><a href="statics.html">Static Variables and Static Class Members</a></li>
   <li><a href="exceptions.html">Exceptions</a></li>
   <li><a href="pointers.html">Pointers</a></li>
   <li><a href="pointers2.html">Pointers II</a></li>
   <li><a href="pointers3.html">Pointers III</a></li>
   <li><a href="assembly.html">Taste of Assembly</a></li>
   <li><a href="smallprograms.html">Small Programs</a></li>
   <li><a href="linkedlist.html">Linked List Examples</a></li>
   <li><a href="binarytree.html">Binary Tree Example Code</a></li>
   <li><a href="stl.html">Standard Template Library (STL) I</a></li>
   <li><a href="stl2.html">Standard Template Library (STL) II - Maps</a></li>
   <li><a href="slicing.html">Object Slicing and Virtual Table</a></li>
   <li><a href="this_pointer.html">The this Pointer</a></li>
   <li><a href="stackunwinding.html">Stack Unwinding</a></li>
   <li><a href="upcasting_downcasting.html">Upcasting and Downcasting</a></li>
   <li><a href="object_returning.html">Object Returning</a></li>
   <li><a href="private_inheritance.html">Private Inheritance</a></li>
   <li><a href="cplusplus_keywords.html">C++_Keywords</a></li>
   <li><a href="multithreaded.html">Multi-Threaded Programming - Terminology</a></li>
   <li><a href="multithreaded2A.html">Multi-Threaded Programming II - Native Thread for Win32 (A) </a></li>
   <li><a href="multithreaded2B.html">Multi-Threaded Programming II -  Native Thread for Win32 (B) </a></li>
   <li><a href="multithreaded2C.html">Multi-Threaded Programming II -  Native Thread for Win32 (C) </a></li>
   <li><a href="multithreaded2.html">Multi-Threaded Programming II - C++ Thread for Win32</a></li>
   <li><a href="multithreaded3.html">Multi-Threaded Programming III - C++ Class Thread for Pthreads</a></li>
   <li><a href="multithreadedDebugging.html">Multithread Debugging</a></li>
   <li><a href="embeddedSystemsProgramming.html">Embedded Systems Programming</a></li>
   <li><a href="boost.html">Boost</a></li>
   <li>Programming Questions and Solutions
    <ul>
       <li><a href="quiz_strings_arrays.html">Strings and Arrays</a></li>
       <li><a href="quiz_linkedlist.html">Linked List</a></li>
       <li><a href="quiz_recursion.html">Recursion</a></li>
       <li><a href="quiz_bit_manipulation.html">Bit Manipulation</a> </li>
       <li><a href="google_interview_questions.html">140 Google Interview Questions</a> </li>
    </ul>
   </li>
</ul>

<br /><br />



<br />


<br />
<br />
<br />


</div>
</div>
<div class="smallgraytext" id="footer"><a href="../index.html">Home</a>
| <a href="../about_us.html">About Us</a>
| <a href="../products.html">products</a>
| <a href="../our_services.html">Our Services</a>
| <a href="#">Contact Us</a>
| Bogotobogo &copy; 2011 | <a target="_blank" href="http://www.bogotobogo.com">Bogotobogo </a>
</div>
</div>
</div>
</body>
</html>
